/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "ProcessSteps")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ProcessSteps.findAll", query = "SELECT p FROM ProcessSteps p"),
    @NamedQuery(name = "ProcessSteps.findByPsid", query = "SELECT p FROM ProcessSteps p WHERE p.psid = :psid"),
    @NamedQuery(name = "ProcessSteps.findByPsDesc", query = "SELECT p FROM ProcessSteps p WHERE p.psDesc = :psDesc")})
public class ProcessSteps implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "psid")
    private Integer psid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "psDesc")
    private String psDesc;
    @OneToMany
    @JoinTable(
        name="JTProcessStepsToVCP",
        joinColumns={ @JoinColumn(name="psid", referencedColumnName="psid")},
        inverseJoinColumns={ @JoinColumn(name="VCPID", referencedColumnName="VCPID", unique=true)}
    )
    private List<VesselCleaningProcedure> vcpCollection;
    @OneToMany
    @JoinTable(
        name="JTProcessStepsToLabType",
        joinColumns={ @JoinColumn(name="psid", referencedColumnName="psid")},
        inverseJoinColumns={ @JoinColumn(name="labTypeID", referencedColumnName="labTypeID", unique=true)}
    )
    private List<LabType> labCollection;

    public ProcessSteps() {
    }

    public ProcessSteps(Integer psid) {
        this.psid = psid;
    }

    public ProcessSteps(Integer psid, String psDesc) {
        this.psid = psid;
        this.psDesc = psDesc;
    }

    public Integer getPsid() {
        return psid;
    }

    public void setPsid(Integer psid) {
        this.psid = psid;
    }

    public String getPsDesc() {
        return psDesc;
    }

    public void setPsDesc(String psDesc) {
        this.psDesc = psDesc;
    }

    public List<VesselCleaningProcedure> getVcpCollection() {
        return vcpCollection;
    }

    public void setVcpCollection(List<VesselCleaningProcedure> vcpCollection) {
        this.vcpCollection = vcpCollection;
    }

    public List<LabType> getLabCollection() {
        return labCollection;
    }

    public void setLabCollection(List<LabType> labCollection) {
        this.labCollection = labCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (psid != null ? psid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProcessSteps)) {
            return false;
        }
        ProcessSteps other = (ProcessSteps) object;
        if ((this.psid == null && other.psid != null) || (this.psid != null && !this.psid.equals(other.psid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.ProcessSteps[ psid=" + psid + " ]";
    }
    
}
